//
//  ShouyeCollecViewController.m
//  KCFurProject
//
//  Created by ios程序员 on 15/11/4.
//  Copyright (c) 2015年 ios程序员. All rights reserved.
//

#import "ShouyeCollecViewController.h"
#import "XiangQingView.h"
#import "HeaderViews.h"
#import "XiangQingCollectionCell.h"
#import "PSXiangQingView.h"
#import "PSXQView.h"
#import "MoMoView.h"
#import "CartViewController.h"
#import "GouWuView.h"


@interface ShouyeCollecViewController ()<UICollectionViewDataSource,UICollectionViewDelegate>

@property (nonatomic ,strong) UISegmentedControl *segment;
@property (nonatomic ,strong) UIImageView *imageViews;
@property (nonatomic ,strong) XiangQingView *topView;
@property (nonatomic ,strong) UICollectionView *toucollectionView;
@property (nonatomic ,strong) PSXQView *psxqView;
@property (nonatomic ,strong) UIImageView *imageView;
@property (nonatomic ,strong) MoMoView *moView;
@property (nonatomic ,strong) GouWuView *gouWuView;


@end

@implementation ShouyeCollecViewController

- (void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBarHidden = NO;
    self.tabBarController.tabBar.alpha = 0;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.hidden = YES;
    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    self.scrollView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.scrollView];

    self.edgesForExtendedLayout = UIRectEdgeNone;
    
    _scrollView.contentSize = CGSizeMake(0, 660*HEIGH);

    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize = CGSizeMake(self.view.frame.size.width / 2-20, self.view.frame.size.width / 2 -20);

    flowLayout.minimumLineSpacing = 5;
    flowLayout.minimumInteritemSpacing = 5;
    flowLayout.sectionInset = UIEdgeInsetsMake(15, 15, 15, 15);
    self.toucollectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) collectionViewLayout:flowLayout];
    self.toucollectionView.delegate = self;
    self.toucollectionView.dataSource =self;
    self.toucollectionView.backgroundColor = [UIColor colorWithRed:246/255.0 green:245/255.0 blue:250/255.0 alpha:1];
    [self.toucollectionView registerClass:[XiangQingCollectionCell class] forCellWithReuseIdentifier:@"reuse"];
    [self.scrollView addSubview:self.toucollectionView];

    [self xiangQingViews];
//    [self headerViewss];
    [self momoViews];
    [self GouWuViews];
    
}

/* 某某 */
- (void)momoViews
{
    self.moView = [[MoMoView alloc] initWithFrame:CGRectMake(0, 40*HEIGH, self.view.frame.size.width, 840*HEIGH)];
    [self.toucollectionView addSubview:self.moView];
}

//加入购物车
- (void)GouWuViews
{
    self.gouWuView = [[GouWuView alloc] initWithFrame:CGRectMake(0, 875*HEIGH, w, 40)];
    [self.gouWuView.liJiButon addTarget:self action:@selector(liJiButonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.toucollectionView addSubview:self.gouWuView];
    
}


/* 资讯热点按钮 */
- (void)xiangQingViews{
    self.topView = [[XiangQingView alloc] initWithFrame:CGRectMake(0, 0, WIDTH * 375, HEIGH  * 50)];
    [self.topView.infoBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    [self.toucollectionView addSubview:self.topView];
    [self.topView.infoBtn addTarget:self action:@selector(infoBtn:) forControlEvents:UIControlEventTouchUpInside];
    [self.topView.sevenBtn addTarget:self action:@selector(sevenBtn:) forControlEvents:UIControlEventTouchUpInside];
}
/* 详情按钮 */
- (void)infoBtn:(UIButton *)button
{
    
}
/* 信息按钮 */
- (void)sevenBtn:(UIButton *)button
{
    
    
}
//加入购物车
- (void)jiaRuButtonClick:(UIButton *)button
{
    
}

//立即购买
- (void)liJiButonClick:(UIButton *)button
{
    CartViewController *cartView = [[CartViewController alloc] init];
    [self.navigationController pushViewController:cartView animated:NO];

}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 0;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    XiangQingCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reuse" forIndexPath:indexPath];
    return cell;
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
{
    return CGSizeMake(self.view.frame.size.width,990*HEIGH);
    
}


//- (void)segmentClick:(UIButton *)button
//{
//
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
